package com.book;

import com.book.modules.util.CoreCodeGeneratorUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.HashMap;
import java.util.Map;

/**
 * Description：
 *
 * @Author： leo.xiong
 * @CreateDate： 2020/04/02 17:34
 * @Email： leo.xiong@suyun360.com
 * Version：1.0
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = BookAuthServerApplication.class)
public class PublicCoreCodeGeneratorUtil {

    @Autowired
    private CoreCodeGeneratorUtil coreCodeGeneratorUtil;

    @Test
    public void publicCodeGeneratorInfo() {
        String parentModelPath = "com.book.oauth.server";
        String tablePrefix = "t_";
        try {
            Map<String, String> expandMap = new HashMap() {{
                put(CoreCodeGeneratorUtil.DATA_SOURCE_NAME, "oauth");
            }};
            CoreCodeGeneratorUtil.coverPublicInfoMap(expandMap);
            coreCodeGeneratorUtil.codeGenerator(parentModelPath, tablePrefix);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
